#coding=utf-8
import sys
import os
from   os.path import abspath, dirname
sys.path.append(abspath(dirname(__file__)))
import tkinter
import tkinter.filedialog
from   tkinter import *
import Fun
import shutil
from glob import glob
ElementBGArray={}  
ElementBGArray_Resize={} 
ElementBGArray_IM={} 
class  ResetPrintClass:
    def __init__(self):
        self.str = ""
    def write(self,s):
        self.str += s
    def getStr(self):
        return self.str
    def clear(self):
        self.str = ""
def mycopyfile(srcfile,dstpath):                       # 复制函数
    if not os.path.isfile(srcfile):
        print ("%s not exist!"%(srcfile))
    else:
        fpath,fname=os.path.split(srcfile)             # 分离文件名和路径
        if not os.path.exists(dstpath):
            os.makedirs(dstpath)                       # 创建路径
        shutil.copy(srcfile, dstpath + fname)          # 复制文件
        print ("copy %s -> %s"%(srcfile, dstpath + fname))
def Button_13_onCommand(uiName,widgetName):
 openPath = tkinter.filedialog.askopenfilename(initialdir=os.path.abspath('.'))
 if openPath != None and len(openPath) > 0:
     src_dir = openPath
     dst_dir = 'E:/测试人脸/'                                    # 目的路径记得加斜杠
     src_file_list = glob(src_dir + '*')                    # glob获得路径下所有文件，可根据需要修改
     for srcfile in src_file_list:
        mycopyfile(srcfile, dst_dir)
def Button_14_onCommand(uiName,widgetName):
    os.system("python ./videoTest.py ")
